cmake_minimum_required(VERSION 3.17)
project(VTKTest)

set(CMAKE_CXX_STANDARD 14)

if(POLICY CMP0020)
    cmake_policy(SET CMP0020 NEW)
    cmake_policy(SET CMP0071 NEW)
endif()
find_package(VTK COMPONENTS
        vtkCommonCore
        vtkFiltersSources
        vtkFiltersSources
        vtkInteractionStyle
        vtkRenderingOpenGL2 QUIET)
if (NOT VTK_FOUND)
    message("Skipping QtBarChart: ${VTK_NOT_FOUND_MESSAGE}")
    return ()
endif()
message (STATUS "VTK_VERSION: ${VTK_VERSION}")

if(vtkGUISupportQt_LOADED OR TARGET VTK::GUISupportQt)
    if (VTK_VERSION VERSION_LESS "8.90.0")
        # Instruct CMake to run moc automatically when needed.
        set(CMAKE_AUTOMOC ON)
        message(11 )
    else()
        # Instruct CMake to run moc automatically when needed.
        set(CMAKE_AUTOMOC ON)
        set(CMAKE_AUTOUIC ON)
    endif()
    # We have ui files, this will bring in the macro: qt5_wrap_ui
    find_package(Qt5Widgets REQUIRED QUIET)
else()
    message(STATUS "GuiSupportQt not found.")
    return()
endif()



add_executable(VTKTest  main.cpp)
target_link_libraries(VTKTest PRIVATE ${VTK_LIBRARIES})
vtk_module_autoinit(
        TARGETS VTKTest
        MODULES ${VTK_LIBRARIES}
)